﻿using System.Data.Entity.ModelConfiguration;
using Systematize.Domain.Entities;

namespace Systematize.Data.EntityFramework.Configuration
{
    public class BookConfiguration : EntityTypeConfiguration<Book>
    {
        public BookConfiguration()
        {
            ToTable("Books");

            HasKey(b => b.Id);

            Property(b => b.Id)
                .HasColumnName("BookId");

            Property(b => b.Name)
                .IsRequired()
                .HasMaxLength(750);

            Property(b => b.Price)
                .HasColumnType("Money");

            Property(b => b.ModifiedOn)
                .HasColumnType("datetime2");
        }
    }
}
